﻿using AviewLightSource;
using FinalTestMachine.Connect;
using FinalTestMachine.Motion.IO;
using FinalTestMachine.Motion.Product;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FinalTestMachine.Motion.Process.SubProcess
{
    public class FifthTestStation : Process_TestStationBase
    {
        public static readonly FifthTestStation Cur = new FifthTestStation();
        public static FifthTestStation CreateInstance() {
            return Cur;
        }

        public override bool AxiOrCylinderToWorkPos()
        {
            if(!StaticIOHelper.Cylinder_Site5Lift.WorkPos(out CyErrInfo))
            {
                WriteErrToUser(CyErrInfo);
                return false;
            }
            return true;
        }

        public override bool AxiOrCylinderToWaitPos()
        {
            if (!StaticIOHelper.Cylinder_Site5Lift.OriginPos(out CyErrInfo))
            {
                WriteErrToUser(CyErrInfo);
                return false;
            }
            return true;
        }

        public override bool OtherActionBeforeExit()
        {
            return true;
        }

        public override ProductTestStation GetCurrentStation()
        {
            return CurrentProduct?.GetTestStation(5);
        }

        public override ProductTestStation GetLastStation()
        {
            return CurrentProduct?.GetTestStation(4);
        }

        private FifthTestStation() : base(SiteConnectManager.Cur.GetCommunicationHelper(5), "工站五", 4)
        {

        }

    }
}
